//
//  YJBTradeDetailBottomView.m
//  WuLiuTong2
//
//  Created by 腾云小白龍 on 16/5/26.
//  Copyright © 2016年 李昭宏. All rights reserved.
//

#import "YJBTradeDetailBottomView.h"

@implementation YJBTradeDetailBottomView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
    }
    
    return self;
}

-(void)initView{
    CGFloat imgViewH = 25;
    CGFloat imgViewW = 20;
    CGFloat labelH   = 18;
    CGFloat margin   = SCREEN_WIDTH/4;
    CGFloat fontSize = 12;
    CGFloat x = (SCREEN_WIDTH / 4 - imgViewW)/2;
    UIImageView *accountImgView  = ({
        UIImageView *imgView =[[UIImageView alloc]initWithFrame:CGRectMake(x, 5, imgViewW, imgViewH)];
        imgView.image = [UIImage imageNamed:@"tab_bar_personal_icon"];
        imgView.contentMode = UIViewContentModeScaleAspectFit;
        imgView;
    });
    [self addSubview:accountImgView];
    
    UILabel *accountLabel = ({
        UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(accountImgView.frame) - 2, SCREEN_WIDTH / 4, labelH)];
        label.text = @"我的账户";
        label.textColor = [UIColor grayColor];
        label.font = [UIFont systemFontOfSize:fontSize];
        label.textAlignment = NSTextAlignmentCenter;
        label;
    });
    [self addSubview:accountLabel];
    
    self.myCountButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH / 4, 50)];
    [self.myCountButton setTitle:@"" forState:UIControlStateNormal];
    [self.myCountButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.myCountButton.titleLabel.font = [UIFont systemFontOfSize:14];


    
    UIImageView *dealImgView  = ({
        UIImageView *imgView =[[UIImageView alloc]initWithFrame:CGRectMake(x + margin, 5, imgViewW, imgViewH)];
        imgView.image = [UIImage imageNamed:@"tabbar_deal_Noraml"];
        imgView.contentMode = UIViewContentModeScaleAspectFit;
        imgView;
    });
    [self addSubview:dealImgView];
    
    UILabel *dealLabel = ({
        UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(margin, CGRectGetMaxY(accountImgView.frame) - 2, SCREEN_WIDTH / 4, labelH)];
        label.text = @"运力买卖";
        label.textColor = [UIColor grayColor];
        label.font = [UIFont systemFontOfSize:fontSize];
        label.textAlignment = NSTextAlignmentCenter;
        label;
    });
    [self addSubview:dealLabel];

    
    self.openBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 4, 0, SCREEN_WIDTH / 4, 50)];
    [self.openBtn setTitle:@"" forState:UIControlStateNormal];
    [self.openBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.openBtn.titleLabel.font = [UIFont systemFontOfSize:14];

    
    UIImageView *recordImgView  = ({
        UIImageView *imgView =[[UIImageView alloc]initWithFrame:CGRectMake(x + margin*2, 5, imgViewW, imgViewH)];
        imgView.image = [UIImage imageNamed:@"tab_bar_search"];
        imgView.contentMode = UIViewContentModeScaleAspectFit;
        imgView;
    });
    [self addSubview:recordImgView];
    
    UILabel *recordLabel = ({
        UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(margin*2, CGRectGetMaxY(accountImgView.frame) - 2, SCREEN_WIDTH / 4, labelH)];
        label.text = @"查询";
        label.textColor = [UIColor grayColor];
        label.font = [UIFont systemFontOfSize:fontSize];
        label.textAlignment = NSTextAlignmentCenter;
        label;
    });
    [self addSubview:recordLabel];
    
    self.entrustBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 4 * 2, 0, SCREEN_WIDTH / 4, 50)];
    [self.entrustBtn setTitle:@"" forState:UIControlStateNormal];
    [self.entrustBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.entrustBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    
    
    
    UIImageView *explainImgView  = ({
        UIImageView *imgView =[[UIImageView alloc]initWithFrame:CGRectMake(x + margin*3, 5, imgViewW, imgViewH)];
        imgView.image = [UIImage imageNamed:@"tabbar_explain_Normal"];
        imgView.contentMode = UIViewContentModeScaleAspectFit;
        imgView;
    });
    [self addSubview:explainImgView];
    
    UILabel *explainLabel = ({
        UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(margin*3, CGRectGetMaxY(accountImgView.frame) - 2, SCREEN_WIDTH / 4, labelH)];
        label.text = @"合约详情";
        label.textColor = [UIColor grayColor];
        label.font = [UIFont systemFontOfSize:fontSize];
        label.textAlignment = NSTextAlignmentCenter;
        label;
    });
    [self addSubview:explainLabel];
    
    self.tradeExplainBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 4 * 3, 0, SCREEN_WIDTH / 4, 50)];
    [self.tradeExplainBtn setTitle:@"" forState:UIControlStateNormal];
    [self.tradeExplainBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.tradeExplainBtn.titleLabel.font = [UIFont systemFontOfSize:14];

    
    [self addSubview:self.myCountButton];
    [self addSubview:self.openBtn];
    [self addSubview:self.entrustBtn];
    [self addSubview:self.tradeExplainBtn];
    
    UIView * dividerView = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 4, 8, 1, 34)];
    dividerView.backgroundColor = DEFAULT_COLOR;
    
    UIView * dividerViewTwo = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 4 * 2, 8, 1, 34)];
    dividerViewTwo.backgroundColor = DEFAULT_COLOR;
    
    UIView * dividerViewThree = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 4 * 3, 8, 1, 34)];
    dividerViewThree.backgroundColor = DEFAULT_COLOR;
    
    [self addSubview:dividerView];
    [self addSubview:dividerViewTwo];
    [self addSubview:dividerViewThree];
    
}
@end
